﻿using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using T.E.ERP.Write.API.Applicantions.Command.ProcurementsCommand;

namespace T.E.ERP.Write.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PurchaseInvoicesController : ControllerBase
    {
        private readonly IMediator mediator;

        public PurchaseInvoicesController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 采购发票新增
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddPurchase(AddPurchaseInvoicesCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 采购发票的审核状态修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> EditPurchaseorderStatue(UpdStateCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 采购订单的添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddPurchaseorder(AddPurcersCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 采购订单的修改
        /// </summary>
        /// <param name="update"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> UpdatePurc(UpdatePurcersCommand update)
        {
            return await mediator.Send(update);
        }


        /// <summary>
        /// 采购到货的修改
        /// </summary>
        /// <param name="update"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> UpdatePurchaseArri(UpdatePurchaseArrivalCommand update)
        {
            return await mediator.Send(update);
        }

        /// <summary>
        /// 采购发票的修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> EditPurchaseorder(EditPurchaseInvoicesCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 采购退货单新增
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddPurchaseArrival(AddPurchaseArrivalCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 采购退货单修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> UpdPurchaseArrival(UpdPurchaseArrivalCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 采购到货添加方法
        /// </summary>
        /// <param name="add"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddPurchaseArrivalder(AddPurcArrivalCommand add)
        {
            return await mediator.Send(add);
        }
    }
}
